﻿@{
    ViewBag.Title = "页面管理";
    Layout = "~/Views/Shared/_TreeLayout.cshtml";
}


<!--树-->


<!--Operation-->
<div class="heading-buttons">


    <div class="col-xs-12 col-sm-7 col-md-7 col-lg-4">
        <h1 class="page-title txt-color-blueDark"><i class="fa  fa-gear "></i>
            页面管理
			
        </h1>
    </div>
    <div class="buttons pull-right">

        <button type="button" class="btn btn-success btn-labeled " id="btnSysPagePowerAdd"
            data-bind="click: $root.AddNewNode">
            <span class="btn-label"><i class="glyphicon glyphicon-plus"></i>
            </span>添加结点</button>

        <button type="button" class="btn btn-primary btn-labeled " id="btnSysPagePowerDel"
            data-bind="click: $root.DelNode">
            <span class="btn-label"><i class="glyphicon glyphicon-remove"></i>
            </span>删除结点</button>


    </div>
    <div style="clear: both;">
    </div>
</div>
<!--/Operation-->


<hr class="separator" />
<!-- Bread crumb is created dynamically -->



<div class="row">

    <div class="col-sm-4" style="margin-bottom: 5px; margin-top: 5px;">
        <div class="well well-light well-sm no-margin no-padding treeContent">
            <!--SysPagePower tree-->
            <ul id="SysPagePowerTree" class="ztree">
            </ul>


        </div>

    </div>
    <!-- end col-sm-61 -->
    <!--/SysPagePower tree-->







    <!--SysPagePower  information-->
    <div class="col-sm-8" style="margin-bottom: 5px; margin-top: 5px;">
        <div class="well well-light well-sm no-margin no-padding treeContent">
            <input type="hidden" id="hidId" />
            <form class="form-horizontal" id="frmSysPagePower" data-bind="with: NodeValue">

                <fieldset>
                    <div class="row" style="border-bottom: dashed 1px; margin-bottom: 10px;">
                        <h3 style="padding: 10px 0 10px 10px; float: left;"><strong>详细信息</strong></h3>
                        <div class="buttons pull-right">


                            <button type="button" id="btnSysPagePowerUpdate" class="btn btn-success btn-labeled " style="margin-top: 5px;" data-bind="click: $root.updateNode">
                                <span class="btn-label"><i class="fa fa-save"></i>
                                </span>保存</button>

                        </div>
                    </div>

                    <div style="clear: both;" />

                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>菜单名称:</label>
                        <div class='col-md-9'>
                            <input type='text' id='txtbSMenuName' name='txtbSMenuName' placeholder='' class='form-control' data-bind='value:SMenuName' />
                        </div>

                    </div>
                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>菜单路径:</label>
                        <div class='col-md-9'>
                            <input type='text' id='txtbSMenuUrl' name='txtbSMenuUrl' placeholder='' class='form-control' data-bind='value:SMenuUrl' />
                        </div>
                    </div>
                    <input type='hidden' id='txtbILevel' name='txtbILevel' placeholder='' class='form-control' data-bind='value:ILevel' />
                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>类型:</label><div class='col-md-9'>
                            <input type='text' id='txtbIType' name='txtbIType' placeholder='' class='form-control' data-bind='value:IType' />
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>菜单图标样式:</label><div class='col-md-9'>
                            <input type='text' id='txtbSPicurl' name='txtbSPicurl' placeholder='' class='form-control' data-bind='value:SPicurl' />
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>菜单类型:</label><div class='col-md-9'>
                            <input type='text' id='txtbIMenuType' name='txtbIMenuType' placeholder='' class='form-control' data-bind='value:IMenuType' />
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>排序方式:</label><div class='col-md-9'>
                            <input type='text' id='txtbISort' name='txtbISort' placeholder='' class='form-control' data-bind='value:ISort' />
                        </div>
                    </div>
                    <div class='form-group'>
                        <label class='col-md-2 control-label' style='margin-bottom: 3px;'>是否可删除:</label><div class='col-md-9'>
                            <input type='text' id='txtbIIsDelete' name='txtbIIsDelete' placeholder='' class='form-control' data-bind='value:IIsDelete' />
                        </div>
                    </div>

                </fieldset>

            </form>

        </div>
    </div>


</div>




@*    </div>

</div>*@

<!-- end row -->
<!--/SysPagePower information-->


<script type="text/javascript">

    var viewModel;
    $(function () {


        var options = {

            renderDiv: $("#SysPagePowerTree"),
            hidId: $("#hidId"),
            frmElement: $("#frmSysPagePower"),



            UpdateBtn: $("#btnSysPagePowerUpdate"),
            AddBtn: $("#btnSysPagePowerAdd"),
            DelBtn: $("#btnSysPagePowerDel"),


            //节点数据
            NodeValue: ko.observable({

                Id: 0, SMenuName: '', SMenuUrl: '', IParentId: 0, ILevel: 0, IPowerId: 0, IType: 0, SPicurl: '', IMenuType: 0, ISort: 0, IIsDelete: 0

            }),

            //用户查询URL
            dataQueryUrlAccessor: function () { return "/api/SysPagePower/TreeAll"; },

            //添加用户URL
            dataAddUrlAccessor: function (key) { return "/api/SysPagePower/AddTreeNode/" + key; },
            dataUpdateAccessor: function (key) { return "/api/SysPagePower/Put/" + key; },
            dataDeleteAccessor: function (key) {


                return "/api/SysPagePower/Delete/" + key;

            },
            dataNodeSelect: function (id) {
                return "/api/SysPagePower/get/" + id;
            }

			, showDlgBefore: function () {
			    //显示对话框之前

			}
                , showDetailEnd: function (data) {


                }
             , changeEnd: function (key, event) {
                 //对话框保存的后置事件
             }, initEd: function () {
                 //gird初始化的后置事件 信息

             }

        };

        viewModel = new ViewModel(options);


        viewModel.init();
        ko.applyBindings(viewModel);




        options.frmElement.validate({
            rules: {


                txtbId: { required: true, digits: true }, txtbSMenuName: { maxlength: 50 }, txtbSMenuUrl: { maxlength: 50 }, txtbIParentId: { digits: true }, txtbILevel: { digits: true }, txtbIPowerId: { digits: true }, txtbIType: { digits: true }, txtbSPicurl: { maxlength: 50 }, txtbIMenuType: { digits: true }, txtbISort: { digits: true }, txtbIIsDelete: { digits: true }



            },
            messages: {


                txtbId: { required: '必填项', digits: '必须是整数' }, txtbSMenuName: { maxlength: '最大长度为250' }, txtbSMenuUrl: { maxlength: '最大长度为2000' }, txtbIParentId: { digits: '必须是整数' }, txtbILevel: { digits: '必须是整数' }, txtbIPowerId: { digits: '必须是整数' }, txtbIType: { digits: '必须是整数' }, txtbSPicurl: { maxlength: '最大长度为250' }, txtbIMenuType: { digits: '必须是整数' }, txtbISort: { digits: '必须是整数' }, txtbIIsDelete: { digits: '必须是整数' }

            }, highlight: function (element) {
                $(element).closest('.form-group').removeClass('has-success').addClass('has-error');
            },
            unhighlight: function (element) {
                $(element).closest('.form-group').removeClass('has-error').addClass('has-success');
            },
            errorElement: 'span',
            errorClass: 'help-block'
        });

    });

</script>




<!--end 树code-->


